home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’89 / Dialoger / load.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-06-15  |  1.1 KB  |  74 lines  |  [TEXT/KAHL]

  1. pascal extern void SHOWINIT(short iconID, short moveX);
  2.  
  3. main()
  4. {
  5.     if (!isoptionkey())
  6.     {
  7.         SHOWINIT(128, -1);
  8.         init();                /* call the init stuff */
  9.     }
  10.     else
  11.         SHOWINIT(129, -1);    /* show the not loaded icon */    
  12. };
  13.  
  14. isoptionkey()
  15. {
  16.     return(iskeydown(58));
  17. };
  18.  
  19.  
  20. /*     What JERKS!!!
  21.     the map looks like :
  22.     
  23.             87654321 FEDCBA9
  24.     for each byte....  HUMMMPH   */
  25.     
  26.     
  27. iskeydown(keycode)
  28. int    keycode;
  29. {
  30.     /* returns true if the key specified in the map by
  31.         keycode is down false otherwise */
  32.         
  33.     KeyMap    thekeys;
  34.     long    mask;
  35.     int        bank;
  36.     int        temp;
  37.         
  38.     GetKeys(&thekeys);    /* check what keys are down -- Option is 58 */
  39.     
  40.     bank = keycode / 32;        /* get the right bank to use */
  41.     temp = (keycode % 32);         /* ok now get the byte .... */
  42.     
  43.     temp = ((temp / 8 ) * 8 ) + ( 7 - (temp % 8));
  44.     
  45.     mask = 1L << ( 31 - temp);
  46.     if (( thekeys.Key[bank] & mask ) == 0 )
  47.         return(0);
  48.     else
  49.         return(1);
  50. };
  51.  
  52.     
  53. #define NULL 0
  54.  
  55. init()
  56. {
  57.     char        **it;
  58.     
  59.     it = (char **)GetResource('Code',1000);
  60.     if (it != NULL)
  61.     {    
  62.         HLock(it);
  63.         jump(*it);
  64.         DetachResource(it);
  65.     };
  66.     return(0);
  67. };
  68.     
  69. jump(it)
  70. int            (*it)();
  71. {
  72.     (*it)();        /* init it */
  73. };
  74.